package com.bit.net.component.data.client;

import com.bit.net.BaseChannelInitializer;
import com.bit.net.EachModulModelMessages;
import com.bit.net.component.data.server.module.time.TimeRequest;
import com.bit.net.component.data.server.module.time.TimeResponse;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 控制中心服务初始化客户端连接.
 *
 * @since 2018/10/10
 */
@Slf4j
@Component
public class DataClientChannelInitializer extends BaseChannelInitializer {


    @Override
    protected void registerModuleMessage(EachModulModelMessages modulModelMessages) {
        modulModelMessages.registerMessage(1, TimeRequest.class);
        modulModelMessages.registerMessage(2, TimeResponse.class);
    }

    @Override
    protected SimpleChannelInboundHandler getBizHandler() {
        return new DataClientResponseChannelHandler();
    }
}
